<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
    <script>

        function createPromise(url) {

            return new Promise(function (resolve, reject) {
                alert(resolve);
                $.ajax({
                        url,
                        dataType: 'json',
                        success(arr) {
                            resolve(arr);
                        },
                        error(err) {
                            reject(err);
                        },
                    }
                );
            });
        }

        Promise.all(createPromise('data/arr.txt'), createPromise('data/json.json')).then(function (arr) {
            alert('all fixedd');
            let [res1, res2] = arr;
            alert(res1)
            alert(JSON.stringify(res2))
        }, function () {
            alert("all faled")
        })

    </script>
</head>
<body>
<input type="button" onclick="setName('哈哈哈哈')" value="提交"/>

</body>
</html>